<template>
  <page-body>
    <view class="page">
      <view class="flex benben-position-layout flex flex-wrap align-center Followfans_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub Followfans_fd0_0'>
          <view class='flex flex-wrap align-center Followfans_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  Followfans_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <view>
              <benben-flex-tabs class-name='Followfans_benbenTabsfd0_0_c1_c0' v-model="tabsTypefd0_0_c1_c0"
                ref="benben_tabsfd0_0_c1_c0" select-mark="benben_tabsfd0_0_c1_c0" key="benben_tabsfd0_0_c1_c0"
                :open-title-type='false' :open-sticky='true' :top='0' :is-show-content='false' :scrollspy='false'
                :tabs-info.sync="tabsInfofd0_0_c1_c0">

                <scroll-view @scroll="tabsInfofd0_0_c1_c0.scrollX = $event.detail.scrollLeft"
                  id="benben_tabsfd0_0_c1_c0" class="benben-tabs" style="width:750rpx" :scroll-x="true"
                  :scroll-left.sync="tabsInfofd0_0_c1_c0.moveX" scroll-with-animation="all .3s ease">
                  <view class="benben-tabs-content" id="benben_tabsfd0_0_c1_c0-content">
                    <view id="benben_tabsfd0_0_c1_c0-title"
                      class="benben-tabs-title flex flex align-center justify-around">
                      <view
                        :class="{ 'checkTitlefd0_0_c1_c0': tabsTypefd0_0_c1_c0 == '1', 'flex flex-wrap align-center': true }"
                        @tap="chooseType(1)" :id="`benben_tabsfd0_0_c1_c0-title-item-${'1'}`">

                        <text>关注</text>

                      </view>
                      <view
                        :class="{ 'checkTitlefd0_0_c1_c0': tabsTypefd0_0_c1_c0 == '2', 'flex flex-wrap align-center': true }"
                        @tap="chooseType(2)" :id="`benben_tabsfd0_0_c1_c0-title-item-${'2'}`">

                        <text>粉丝</text>

                      </view>
                    </view>
                    <view :style="{ left: tabsInfofd0_0_c1_c0.lineleft, maxWidth: tabsInfofd0_0_c1_c0.lineWidth ,}"
                      id="benben_tabsfd0_0_c1_c0-line"
                      class="benben-tabs-line flex benben-flex-tabs-line Followfans_linefd0_0_c1_c0"></view>
                  </view>
                </scroll-view>

              </benben-flex-tabs>

            </view>
          </view>
          <view class='flex flex-wrap align-center justify-end Followfans_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction align-stretch benben-flex-layout Followfans_flex_1">
        <view class='flex flex-wrap align-center justify-between Followfans_fd1_0'>
          <view class='flex align-center Followfans_fd1_0_c0'>
            <image class='Followfans_fd1_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"187.png"'></image>
            <benben-input class='flex-sub Followfans_fd1_0_c0_c1' type="text" :placeholder="`请输入ID和昵称`"
              confirm-type="done" :maxlength="-1" v-model="keywords" @confirm="getgb37c9f95780cbFunc()"
              placeholder-style="color:#999;font-size:28rpx" />
          </view>
          <text @click.stop="getgb37c9f95780cbFunc()">搜索</text>
        </view>
        <view class='flex flex-wrap align-center justify-between Followfans_fd1_0'>
          <text>全部（{{total}}）</text>
        </view>
        <view class='flex align-center Followfans_fd1_1' v-for="(item,index) in dataList" :key="index"
          @tap.stop="godetail(item)" data-type="navigateTo"
          :data-url="`/pages/grzx/userhome/userhome?aid=${item.caozuorenID}`">
          <image class='Followfans_fd1_1_c0' mode="aspectFill" :src='item.avatar'></image>
          <view class='flex flex-direction align-stretch flex-sub'>
            <text class='Followfans_fd1_1_c1_c0'>{{item.nickname}}</text>
            <view class='flex flex-wrap align-center Followfans_fd1_1_c1_c1'>
              <view class='flex flex-wrap align-center'>
                <text>id:{{tabsTypefd0_0_c1_c0==1 ? item.user_id : item.fans_id}}</text>
              </view>

              <view class='flex  Followfans_fd1_1_c1_c1_c1'></view>

            </view>
          </view>
          <button class='Followfans_fd1_1_c2' v-if="item.is_follow==1 && tabsTypefd0_0_c1_c0==1"
            @click.stop="collect(item)">已关注</button>
          <button class='Followfans_fd1_1_c2s' v-if="item.is_follow==0 && tabsTypefd0_0_c1_c0==1"
            @click.stop="collect(item)">取消关注</button>

          <button class='visitor_fd1_0_c3' v-if="item.is_follow==0 && tabsTypefd0_0_c1_c0==2"
            @click.stop="collect(item)">回粉</button>
          <button class='Followfans_fd1_1_c21' v-if="item.is_follow==1 && tabsTypefd0_0_c1_c0==2"
            @click.stop="collect(item)">互相关注</button>

        </view>
        <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
          :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
      </view>

      <!---flex布局flex布局结束-->
      <benben-popup v-model="popupShow1721099154137" :mask="true" :mask-close-able="false" mode='center'>
        <!---删除弹窗flex布局开始-->
        <view class="flex flex-direction flex-wrap align-center Followfans_flex_2">
          <text class='Followfans_fd2_0'>提示</text>
          <text class='Followfans_fd2_1'>确认取消关注吗？</text>
          <view class='flex flex-wrap align-center Followfans_fd2_2'>
            <button class='Followfans_fd2_2_c0'>取消</button>
            <button class='Followfans_fd2_2_c1'>确认</button>
          </view>
        </view>

        <!---删除弹窗flex布局结束-->

      </benben-popup>


    </view>
  </page-body>
</template>
<script>
  import pagingList from '@/common/mixin/paging_list.js';
  import {
    validate
  } from '@/common/utils/validate.js'

  export default {
    components: {},
    mixins: [pagingList],

    data() {
      return {
        "popupShow1721099154137": false,
        "tabsInfofd0_0_c1_c0": {
          lineleft: '',
          lineWidth: '',
          moveX: 0,
          scrollX: 0,
          PageScrollX: 0
        },
        "tabsTypefd0_0_c1_c0": "1",
        "minixPagingListsApi": "",
        "pageingListApiMethod": "",
        "allowOnloadGetList": false,
        "type": "1",
        "keywords": "",
        "dataList": [],
        "messageInfo": {
          "is_follow": ""
        },
        "user_id": "",
        total: 0
      };
    },
    computed: {

    },
    watch: {},
    onLoad(options) {
      let {
        user_id,
        type
      } = options
      if (user_id !== undefined) this.user_id = user_id
      if (type !== undefined) this.tabsTypefd0_0_c1_c0 = type
      this.getgb37c9f95780cbFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      godetail(item) {
        if (this.tabsTypefd0_0_c1_c0 == 1) {
          uni.navigateTo({
            url: `/pages/grzx/userhome/userhome?aid=${item.user_id}`
          })
        } else {
          uni.navigateTo({
            url: `/pages/grzx/userhome/userhome?aid=${item.fans_id}`
          })
        }
      },
      chooseType(type) {
        this.tabsTypefd0_0_c1_c0 = type
        this.getgb37c9f95780cbFunc()
      },
      // post669b1d0232445
      collect(item) {
        let user_id = ''
        if (this.tabsTypefd0_0_c1_c0 == 1) {
          user_id = item.user_id
        } else {
          user_id = item.fans_id
        }
        this.$api.post(global.apiUrls.post669b1d0232445, {
          user_id: user_id
        }).then(res => {
          if (res.data.code == 1) {
            this.getgb37c9f95780cbFunc()
          } else {
            this.$message.info(res.data.msg)
          }
        })
      },
      //取消关注
      getyNum() {
        this.$api.post(global.apiUrls.post669b1d43d7d8f, {
          type: this.tabsTypefd0_0_c1_c0,
          name: this.keywords
        }).then(res => {
          if (res.data.code == 1) {
            this.total = res.data.data.total
          } else {
            this.$message.info(res.data.msg)
          }
        })
      },
      //用户管理-关注列表
      getgb37c9f95780cbFunc() {
        this.getyNum()
        this.minixPagingListsApi = global.apiUrls.post669b1d43d7d8f;
        this.pageingListApiMethod = 'post';
        this.allowOnloadGetList = false;
        this.pagingListPostDataContent = {
          type: this.tabsTypefd0_0_c1_c0,
          name: this.keywords
        }
        this.listData = [];
        this.dataList = this.listData;
        this.pagingListToggle();

      },
      pagingListPostData() {
        return this.pagingListPostDataContent
      }
    }
  };
</script>
<style lang="scss" scoped>
  .visitor_fd1_0_c3 {
    background: linear-gradient(180deg, #176BE8 0%, #5A5CFC 100%);
    border-radius: 29rpx 29rpx 29rpx 29rpx;
    width: 144rpx;
    line-height: 56rpx;
    font-size: 24rpx;
    color: #fff;
    height: 56rpx;
  }

  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(255, 255, 255, 1);
    background-size: 100% auto;
  }

  .Followfans_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .Followfans_linefd0_0_c1_c0 {
    background: url(image-path('161.png')) no-repeat;
    width: 50rpx;
    height: 12rpx;
    top: 70rpx;
    background-size: 100% auto !important;
  }

  .checkTitlefd0_0_c1_c0 {
    font-weight: 700 !important;
    font-size: 32rpx !important;
    color: #176BE8 !important;
    background-color: rgba(255, 255, 255, 1) !important;
  }

  ::v-deep .Followfans_benbenTabsfd0_0_c1_c0 {
    background: #fff;
    width: 300rpx;
    height: 90rpx;
    white-space: nowrap;
    text-align: center;
    color: rgba(102, 102, 102, 1);
    font-size: 32rpx;
  }

  .Followfans_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .Followfans_fd0_0_c0 {
    width: 120rpx;
  }

  .Followfans_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .Followfans_flex_1 {
    background: var(--benbenbgColor1);
    padding: 0rpx 24rpx 0rpx 24rpx;
    background-size: 100% auto !important;
  }

  .Followfans_fd1_1_c21 {
    background: linear-gradient(180deg, #176BE8 0%, #5A5CFC 100%);
    border-radius: 33rpx 33rpx 33rpx 33rpx;
    width: 144rpx;
    line-height: 56rpx;
    font-size: 24rpx;
    color: #FFFFFF;
    height: 56rpx;
    opacity: 0.5;
  }

  .Followfans_fd1_1_c2 {
    background: #F8F8F8;
    border-radius: 33rpx 33rpx 33rpx 33rpx;
    width: 112rpx;
    line-height: 56rpx;
    font-size: 24rpx;
    color: var(--benbenFontColor0);
    height: 56rpx;
  }

  .Followfans_fd1_1_c2s {
    background: #FFFFFF;
    border: 2rpx solid #EEEEEE;
    border-radius: 33rpx 33rpx 33rpx 33rpx;
    width: 144rpx;
    line-height: 56rpx;
    font-size: 24rpx;
    color: var(--benbenFontColor0);
    height: 56rpx;
  }

  .Followfans_fd1_1_c1_c1_c1 {
    background: var(--benbenbgColor6);
    width: 1rpx;
    height: 30rpx;
    margin: 0rpx 10rpx 0rpx 10rpx;
    transform: scaleX(0.5);
  }

  .Followfans_fd1_1_c1_c1 {
    color: #999999;
    font-size: 24rpx;
    line-height: 33rpx;
    font-weight: 400;
  }

  .Followfans_fd1_1_c1_c0 {
    color: #333333;
    font-size: 28rpx;
    font-weight: 500;
    line-height: 40rpx;
    margin: 0rpx 0rpx 16rpx 0rpx;
  }

  .Followfans_fd1_1_c0 {
    width: 88rpx;
    height: 88rpx;
    border-radius: 100rpx;
    margin: 0rpx 16rpx 0rpx 0rpx;
  }

  .Followfans_fd1_1 {
    // border-bottom: 1px solid #eee;
    padding: 32rpx 0rpx 32rpx 0rpx;
  }

  .Followfans_fd1_0_c0_c1 {
    color: var(--benbenFontColor0);
  }

  .Followfans_fd1_0_c0_c0 {
    width: 24rpx;
    height: 24rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 24rpx 0rpx 0rpx;
  }

  .Followfans_fd1_0_c0 {
    background: #F8F8F8;
    border-radius: 32rpx 32rpx 32rpx 32rpx;
    height: 64rpx;
    padding: 0rpx 32rpx 0rpx 32rpx;
    width: 598rpx;
  }

  .Followfans_fd1_0 {
    margin: 32rpx 0rpx 24rpx 0rpx;
  }

  .Followfans_flex_2 {
    background: #fff;
    width: 540rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
  }

  .Followfans_fd2_2_c1 {
    border-top: 1px solid #eee;
    border-left: 1px solid #eee;
    background: #fff;
    line-height: 110rpx;
    border-radius: 0rpx 0rpx 16rpx 0rpx;
    font-size: 32rpx;
    color: rgba(23, 107, 232, 1);
    font-weight: 500;
    width: 270rpx;
  }

  .Followfans_fd2_2_c0 {
    border-top: 1px solid #eee;
    background: #fff;
    line-height: 110rpx;
    border-radius: 0rpx 0rpx 0rpx 16rpx;
    font-size: 32rpx;
    color: rgba(153, 153, 153, 1);
    font-weight: 500;
    width: 270rpx;
  }

  .Followfans_fd2_2 {
    margin: 37rpx 0rpx 0rpx 0rpx;
  }

  .Followfans_fd2_1 {
    line-height: 52rpx;
    font-size: 32rpx;
    font-weight: 400;
    color: #333333;
    margin: 0rpx 32rpx 0rpx 32rpx;
    text-align: center;
  }

  .Followfans_fd2_0 {
    font-size: 36rpx;
    font-weight: 700;
    line-height: 32rpx;
    color: #333333;
    margin: 40rpx 0rpx 40rpx 0rpx;
  }
</style>
